<!DOCTYPE html><html lang="ja">
<head>
<meta charset="UTF-8" />
<title>msgpack codec test</title>
<style>
.uutest ol { background-color:dodgerblue;color:white }
.uutest li { padding:5px;border:1px solid #ccc }
.uutest .li0 { background-color:red   }
.uutest .li1 { background-color:green }
.uutest .li2 { background-color:red   }
.uutest .li3 { background-color:#0a0  }
.uutestinfo { position:fixed;top:10px;right:10px;font-size:xx-large }
.uutestinfo a { border: 3px outset gray;padding:3px;background-color:red;color:white }
.uutestinfo .score { color:black;text-shadow:gray 1px 1px 1px }
.uutestinfo .ngzone {}
</style>
<script src="../msgpack.js"></script>
<script src="uupaa.js"></script>
<script>
uu.test = function(hash) {
    var r, i;

    for (i in hash) {
        v = hash[i];
        if (v === "") { // caption
            uu.ok(i);
        } else {
            r = v();
            uu.ok(i, r[0], r[1], r[2], r[3]);
        }
    }
    uu.ok();
};
uu.ready(function(uu) {
    var hex = function(ary) {
        return uu.array.dump(ary, "0x", ", 0x");
    };

    uu.test({
        "FixNum, uint and int": "",
            "Number(0) -> [0x00] (Positive FixNum)": function() {
                var pack = msgpack.pack(0);
                var rv = msgpack.unpack(pack);

                return [rv, "==", 0, hex(pack)];
            },
            "Number(1) -> [0x01] (Positive FixNum)": function() {
                var pack = msgpack.pack(1);
                var rv = msgpack.unpack(pack);

                return [rv, "==", 1, hex(pack)];
            },
            "Number(31) -> [0x1f] (Positive FixNum)": function() {
                var pack = msgpack.pack(31);
                var rv = msgpack.unpack(pack);

                return [rv, "==", 31, hex(pack)];
            },
            "Number(32) -> [0x20] (Positive FixNum)": function() {
                var pack = msgpack.pack(32);
                var rv = msgpack.unpack(pack);

                return [rv, "==", 32, hex(pack)];
            },
            "Number(33) -> [0x21] (Positive FixNum)": function() {
                var pack = msgpack.pack(33);
                var rv = msgpack.unpack(pack);

                return [rv, "==", 33, hex(pack)];
            },
            "Number(126) -> [0x7e] (Positive FixNum)": function() {
                var pack = msgpack.pack(126);
                var rv = msgpack.unpack(pack);

                return [rv, "==", 126, hex(pack)];
            },
            "Number(127) -> [0x7f] (Positive FixNum)": function() {
                var pack = msgpack.pack(127);
                var rv = msgpack.unpack(pack);

                return [rv, "==", 127, hex(pack)];
            },
            "Number(128) -> [0xcc, 0x80] (uint8)": function() {
                var pack = msgpack.pack(128);
                var rv = msgpack.unpack(pack);

                return [rv, "==", 128, hex(pack)];
            },
            "Number(129) -> [0xcc, 0x81] (uint8)": function() {
                var pack = msgpack.pack(129);
                var rv = msgpack.unpack(pack);

                return [rv, "==", 129, hex(pack)];
            },
            "Number(0xfe) -> [0xcc, 0xfe] (uint8)": function() {
                var pack = msgpack.pack(0xfe);
                var rv = msgpack.unpack(pack);

                return [rv, "==", 0xfe, hex(pack)];
            },
            "Number(0xff) -> [0xcc, 0xff] (uint8)": function() {
                var pack = msgpack.pack(0xff);
                var rv = msgpack.unpack(pack);

                return [rv, "==", 0xff, hex(pack)];
            },
            "Number(0x100) -> [0xcd, 0x1, 0x0] (uint16)": function() {
                var pack = msgpack.pack(0x100);
                var rv = msgpack.unpack(pack);

                return [rv, "==", 0x100, hex(pack)];
            },
            "Number(0x101) -> [0xcd, 0x1, 0x1] (uint16)": function() {
                var pack = msgpack.pack(0x101);
                var rv = msgpack.unpack(pack);

                return [rv, "==", 0x101, hex(pack)];
            },
            "Number(0xfffe) -> [0xcd, 0xff, 0xfe] (uint16)": function() {
                var pack = msgpack.pack(0xfffe);
                var rv = msgpack.unpack(pack);

                return [rv, "==", 0xfffe, hex(pack)];
            },
            "Number(0xffff) -> [0xcd, 0xff, 0xff] (uint16)": function() {
                var pack = msgpack.pack(0xffff);
                var rv = msgpack.unpack(pack);

                return [rv, "==", 0xffff, hex(pack)];
            },
            "Number(0x10000) -> [0xcd, 0xff, 0xff] (uint32)": function() {
                var pack = msgpack.pack(0x10000);
                var rv = msgpack.unpack(pack);

                return [rv, "==", 0x10000, hex(pack)];
            },
            "Number(0x10001) -> [0xce, 0x0, 0x1, 0x0, 0x1] (uint32)": function() {
                var pack = msgpack.pack(0x10001);
                var rv = msgpack.unpack(pack);

                return [rv, "==", 0x10001, hex(pack)];
            },
            "Number(0xffffffff) -> [0xce, 0xff, 0xff, 0xff, 0xff] (uint32)": function() {
                var pack = msgpack.pack(0xffffffff);
                var rv = msgpack.unpack(pack);

                return [rv, "==", 0xffffffff, hex(pack)];
            },
            "Number(0x100000000) -> [0xcf, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00] (uint64)": function() {
                var pack = msgpack.pack(0x100000000);
                var rv = msgpack.unpack(pack);

                return [rv, "==", 0x100000000, hex(pack)];
            },
            "Number(0x10000000000) -> [0xcf, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00] (uint64)": function() {
                var pack = msgpack.pack(0x10000000000);
                var rv = msgpack.unpack(pack);

                return [rv, "==", 0x10000000000, hex(pack)];
            },
            "Number(0x1000000000000) -> [0xcf, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] (uint64)": function() {
                var pack = msgpack.pack(0x1000000000000);
                var rv = msgpack.unpack(pack);

                return [rv, "==", 0x1000000000000, hex(pack), "281474976710656"];
            },
            "Number(0x1fffffffffffff) -> [0xcf, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff] (uint64)": function() {
                var pack = msgpack.pack(0x1fffffffffffff);
                var rv = msgpack.unpack(pack);

                return [rv, "==", 0x1fffffffffffff, hex(pack), "9007199254740991"];
            },
            "Number(0x20000000000000) -> [0xcf, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] (uint64)": function() {
                var pack = msgpack.pack(0x20000000000000);
                var rv = msgpack.unpack(pack);

                return [rv, "==", 0x20000000000000, hex(pack), "9007199254740992"];
            },
            "Number(0x40000000000000) -> [0xcf, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] (uint64)": function() {
                var pack = msgpack.pack(0x40000000000000);
                var rv = msgpack.unpack(pack);

                return [rv, "==", 0x40000000000000, hex(pack), "18014398509481984"];
            },
            "!! (Accuracy problems) Number(0x80000000000000) -> [] (uint64)": function() {
                var pack = msgpack.pack(0x80000000000000);
                var rv = msgpack.unpack(pack);

                return [rv, "==", 0x80000000000000, hex(pack), "正しくは 36028797018963968 == 36028797018963968"];
            },
            "!! (Accuracy problems) Number(0x7fffffffffffffff) -> [] (uint64)": function() {
                var pack = msgpack.pack(0x7fffffffffffffff);
                var rv = msgpack.unpack(pack);

                return [rv, "==", 0x7fffffffffffffff, hex(pack), "正しくは 9223372036854775807 == 9223372036854775807"];
            },
            "Number(-0) -> [0x00] (Negative FixNum)": function() {
                var pack = msgpack.pack(-0);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -0, hex(pack)];
            },
            "Number(-1) -> [0xff] (Negative FixNum)": function() {
                var pack = msgpack.pack(-1);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -1, hex(pack)];
            },
            "Number(-31) -> [0xe1] (Negative FixNum)": function() {
                var pack = msgpack.pack(-31);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -31, hex(pack)];
            },
            "Number(-32) -> [0xe0] (Negative FixNum)": function() {
                var pack = msgpack.pack(-32);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -32, hex(pack)];
            },
            "Number(-33) -> [0xd0, 0xdf] (int 8)": function() {
                var pack = msgpack.pack(-33);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -33, hex(pack)];
            },

            "Number(-64) -> [0xd0, 0xc0] (int 8)": function() {
                var pack = msgpack.pack(-64);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -64, hex(pack)];
            },

            "Number(-126) -> [0xd0, 0x82] (int 8)": function() {
                var pack = msgpack.pack(-126);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -126, hex(pack)];
            },
            "Number(-127) -> [0xd0, 0x81] (int 8)": function() {
                var pack = msgpack.pack(-127);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -127, hex(pack)];
            },
            "Number(-128) -> [0xd1, 0xff, 0x80] (int 16)": function() {
                var pack = msgpack.pack(-128);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -128, hex(pack)];
            },
            "Number(-129) -> [0xd1, 0xff, 0x7f] (int 16)": function() {
                var pack = msgpack.pack(-129);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -129, hex(pack)];
            },
            "Number(-254) -> [0xd1, 0xff, 0x02] (int 16)": function() {
                var pack = msgpack.pack(-254);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -254, hex(pack)];
            },
            "Number(-255) -> [0xd1, 0xff, 0x01] (int 16)": function() {
                var pack = msgpack.pack(-255);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -255, hex(pack)];
            },
            "Number(-256) -> [0xd1, 0xff, 0x00] (int 16)": function() {
                var pack = msgpack.pack(-256);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -256, hex(pack)];
            },
            "Number(-257) -> [0xd1, 0xfe, 0xff] (int 16)": function() {
                var pack = msgpack.pack(-257);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -257, hex(pack)];
            },
            "Number(-32767) -> [0xd1, 0x80, 0x01] (int 16)": function() {
                var pack = msgpack.pack(-32767);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -32767, hex(pack)];
            },
            "Number(-32768) -> [0xd2, 0xff, 0xff, 0x80, 0x00] (int 32)": function() {
                var pack = msgpack.pack(-32768);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -32768, hex(pack)];
            },
            "Number(-32769) -> [0xd2, 0xff, 0xff, 0x7f, 0xff] (int 32)": function() {
                var pack = msgpack.pack(-32769);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -32769, hex(pack)];
            },
            "Number(-65534) -> [0xd2, 0xff, 0xff, 0x00, 0x02] (int 32)": function() {
                var pack = msgpack.pack(-65534);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -65534, hex(pack)];
            },
            "Number(-65535) -> [0xd2, 0xff, 0xff, 0x00, 0x01] (int 32)": function() {
                var pack = msgpack.pack(-65535);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -65535, hex(pack)];
            },
            "Number(-65536) -> [0xd2, 0xff, 0xff, 0x00, 0x00] (int 32)": function() {
                var pack = msgpack.pack(-65536);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -65536, hex(pack)];
            },
            "Number(-65537) -> [0xd2, 0xff, 0xfe, 0xff, 0xff] (int 32)": function() {
                var pack = msgpack.pack(-65537);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -65537, hex(pack)];
            },

            "Number(-1048576) -> [0xd2, 0xff, 0xf0, 0x00, 0x00] (int 32)": function() {
                var pack = msgpack.pack(-1048576);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -1048576, hex(pack)];
            },
            "Number(-2147483646) -> [0xd2, 0x80, 0x00, 0x00, 0x02] (int 32)": function() {
                var pack = msgpack.pack(-2147483646);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -2147483646, hex(pack)];
            },
            "Number(-2147483647) -> [0xd2, 0x80, 0x00, 0x00, 0x01] (int 32)": function() {
                var pack = msgpack.pack(-2147483647);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -2147483647, hex(pack)];
            },
            "Number(-2147483648) -> [0xd3, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00] (int 64)": function() {
                var pack = msgpack.pack(-2147483648);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -2147483648, hex(pack)];
            },
            "Number(-549755813888) -> [0xd3, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00] (int 64)": function() {
                var pack = msgpack.pack(-549755813888);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -549755813888, hex(pack)];
            },
            "Number(-4294967293) -> [0xd3, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03] (int 64)": function() {
                var pack = msgpack.pack(-4294967293);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -4294967293, hex(pack)];
            },
            "Number(-4294967294) -> [0xd3, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02] (int 64)": function() {
                var pack = msgpack.pack(-4294967294);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -4294967294, hex(pack)];
            },
            "Number(-4294967295) -> [0xd3, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01] (int 64)": function() {
                var pack = msgpack.pack(-4294967295);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -4294967295, hex(pack)];
            },
            "Number(-4294967296) -> [0xd3, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00] (int 64)": function() {
                var pack = msgpack.pack(-4294967296);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -4294967296, hex(pack)];
            },
            "Number(-4294967297) -> [0xd3, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff] (int 64)": function() {
                var pack = msgpack.pack(-4294967297);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -4294967297, hex(pack)];
            },
            "Number(-0x1fffffffffffff) -> [0xd3, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01] (int64)": function() {
                var pack = msgpack.pack(-0x1fffffffffffff);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -0x1fffffffffffff, hex(pack), "-9007199254740991"];
            },
            "Number(-0x20000000000000) -> [0xd3, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] (int64)": function() {
                var pack = msgpack.pack(-0x20000000000000);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -0x20000000000000, hex(pack), "-9007199254740992"];
            },
            "Number(-0x40000000000000) -> [0xd3, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] (int64)": function() {
                var pack = msgpack.pack(-0x40000000000000);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -0x40000000000000, hex(pack), "-18014398509481984"];
            },

            "unpack(unescape('%d3%ff%e0%00%00%00%00%00%01')) -> -9007199254740991 (int64)": function() {
                var rv = msgpack.unpack(unescape("%d3%ff%e0%00%00%00%00%00%01"));

                return [rv, "==", -0x1fffffffffffff, "-9007199254740991"];
            },

        "Nil (as null)": "",
            "null -> [0xc0] (nil)": function() {
                var pack = msgpack.pack(null);
                var rv = msgpack.unpack(pack);

                return [rv, "==", null, hex(pack)];
            },

        "Boolean": "",
            "true -> [0xc3]": function() {
                var pack = msgpack.pack(true);
                var rv = msgpack.unpack(pack);

                return [rv, "==", true, hex(pack)];
            },
            "false -> [0xc2]": function() {
                var pack = msgpack.pack(false);
                var rv = msgpack.unpack(pack);

                return [rv, "==", false, hex(pack)];
            },
        "Float (as Number, decode only)": "",
            "unpack(unescape('%ca%c2%ed%40%00')) -> -118.625 (float)": function() {
                var rv = msgpack.unpack(unescape("%ca%c2%ed%40%00"));

                return [rv, "==", -118.625];
            },
        "Double (as Number)": "",
            "Number(123.456) -> [0xcb, 0x40, 0x5e, 0xdd, 0x2f, 0x1a, 0x9f, 0xbe, 0x77] (double)": function() {
                var pack = msgpack.pack(123.456);
                var rv = msgpack.unpack(pack);

                return [rv, "==", 123.456, hex(pack)];
            },
            "Number(-123.456) -> [0xcb, 0xc0, 0x5e, 0xdd, 0x2f, 0x1a, 0x9f, 0xbe, 0x77] (double)": function() {
                var pack = msgpack.pack(-123.456);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -123.456, hex(pack)];
            },
            "Number(0.1) -> [0xcb, 0x3f, 0xb9, 0x99, 0x99, 0x99, 0x99, 0x99, 0x9a] (double)": function() {
                var pack = msgpack.pack(0.1);
                var rv = msgpack.unpack(pack);

                return [rv, "==", 0.1, hex(pack)];
            },
            "Number(-0.1) -> [0xcb, 0xbf, 0xb9, 0x99, 0x99, 0x99, 0x99, 0x99, 0x9a] (double)": function() {
                var pack = msgpack.pack(-0.1);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -0.1, hex(pack)];
            },

            "Number(1.11) -> [0xcb, 0xbf, 0xf1, 0xc2, 0x8f, 0x5c, 0x28, 0xf5, 0xc3] (double)": function() {
                var pack = msgpack.pack(1.11);
                var rv = msgpack.unpack(pack);

                return [rv, "==", 1.11, hex(pack)];
            },
            "Number(-1.11) -> [0xcb, 0xbf, 0xf1, 0xc2, 0x8f, 0x5c, 0x28, 0xf5, 0xc3] (double)": function() {
                var pack = msgpack.pack(-1.11);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -1.11, hex(pack)];
            },

            "Number(3.14159565358979) -> [0xcb, 0x40, 0x09, 0x21, 0xfc, 0xe6, 0xeb, 0x64, 0x22] (double)": function() {
                var pack = msgpack.pack(3.14159565358979);
                var rv = msgpack.unpack(pack);

                return [rv, "==", 3.14159565358979, hex(pack)];
            },
            "Number(-3.14159565358979) -> [0xcb, 0xc0, 0x09, 0x21, 0xfc, 0xe6, 0xeb, 0x64, 0x22] (double)": function() {
                var pack = msgpack.pack(-3.14159565358979);
                var rv = msgpack.unpack(pack);

                return [rv, "==", -3.14159565358979, hex(pack)];
            },
        "Raw (as String)": "",
            "String('') -> [0xa0] (FixRaw)": function() {
                var pack = msgpack.pack("");
                var rv = msgpack.unpack(pack);

                return [rv, "==", "", hex(pack)];
            },
            "String('abc') -> [0xa3, 0x61, 0x62, 0x63] (FixRaw)": function() {
                var pack = msgpack.pack("abc");
                var rv = msgpack.unpack(pack);

                return [rv, "==", "abc", hex(pack)];
            },
            "String('あいう') -> [0xa9, 0xe3, 0x81, 0x82, 0xe3, 0x81, 0x84, 0xe3, 0x81, 0x86] (FixRaw)": function() {
                var pack = msgpack.pack("あいう");
                var rv = msgpack.unpack(pack);

                return [rv, "==", "あいう", hex(pack)];
            },
            "String('カルビx3, ハラミx2, ブタバラ, T-BORNx500g, ライス大盛りで') -> [] (Raw16)": function() {
                var pack = msgpack.pack("カルビx3, ハラミx2, ブタバラ, T-BORNx500g, ライス大盛りで");
                var rv = msgpack.unpack(pack);

                return [rv, "==", "カルビx3, ハラミx2, ブタバラ, T-BORNx500g, ライス大盛りで", hex(pack)];
            },
        "Map (as Hash)": "",
            "Hash({}) -> [0x80] (FixMap)": function() {
                var pack = msgpack.pack({});
                var rv = msgpack.unpack(pack);

                return [rv, "==", {}, hex(pack)];
            },
            "Hash({ 'abc': [123] }) -> [0x81, 0xa3, 0x61, 0x62, 0x63, 0x91, 0x7b] (FixMap)": function() {
                var pack = msgpack.pack({ "abc": [123] });
                var rv = msgpack.unpack(pack);

                return [rv, "==", { "abc": [123] }, hex(pack)];
            },
            "Hash({ abc: [123, 456], a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: 7, h: 8, i: 9, j: 10, k: 11, l: 12, l: 13, m: 14, n: 15, o: 16, p: 17 }) -> [0xde, 0x00, ...] (Map16)": function() {
                var hash = { abc: [123, 456], a: 1, b: 2, c: 3, d: 4, e: 5,
                                              f: 6, g: 7, h: 8, i: 9, j: 10,
                                              k: 11, l: 12, l: 13, m: 14,
                                              n: 15, o: 16, p: 17 };
                var pack = msgpack.pack(hash);
                var rv = msgpack.unpack(pack);

                return [rv, "==", hash, hex(pack)];
            },
        "Array": "",
            "Array([]) -> [0x90] (FixArray)": function() {
                var pack = msgpack.pack([]);
                var rv = msgpack.unpack(pack);

                return [rv, "==", [], hex(pack)];
            },
            "Array([123]) -> [0x91, 0x7b] (FixArray)": function() {
                var pack = msgpack.pack([123]);
                var rv = msgpack.unpack(pack);

                return [rv, "==", [123], hex(pack)];
            },
            "Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'hoge']) -> [0xdc, 0x00, ...] (Array16)": function() {
                var ary = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'hoge'];
                var pack = msgpack.pack(ary);
                var rv = msgpack.unpack(pack);

                return [rv, "==", ary, hex(pack)];
            },
        "Complex": "",
            "Hash({ a: ['b', 1, 0.123, { c: {}, d: null }, -1.11] }) -> [] (Map)": function() {
                var data = { a: ['b', 1, 0.123, { c: {}, d: null }, -1.11] };
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "==", data, hex(pack)];
            },
        "Unofficial Objects": "",
            "Math": function() {
                var data = Math;
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is hash", void 0, hex(pack)];
            },
            "Date": function() {
                var data = new Date;
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is hash", void 0, hex(pack)];
            },
            "Function": function() {
                var data = function hoge() {};
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is hash", void 0, hex(pack)];
            },
            "RegExp": function() {
                var data = /^aaa/;
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is hash", void 0, hex(pack)];
            },

        "Compatibility (http://github.com/msgpack/msgpack/blob/master/test/cases_gen.rb)": "",
            "[cc 00] 0 uint8": function() {
                var data = unescape('%cc%00');
                var result = [0xcc, 0x00];
                var rv = msgpack.unpack(data);

                return [rv, "==", 0, hex(result)];
            },
            "[cd 00 00] 0 uint16": function() {
                var data = unescape('%cd%00%00');
                var result = [0xcd, 0x00, 0x00];
                var rv = msgpack.unpack(data);

                return [rv, "==", 0, hex(result)];
            },
            "[ce 00 00 00 00] 0 uint32": function() {
                var data = unescape('%ce%00%00%00%00');
                var result = [0xce, 0x00, 0x00, 0x00];
                var rv = msgpack.unpack(data);

                return [rv, "==", 0, hex(result)];
            },
            "[cf 00 00 00 00 00 00 00 00] 0 uint64": function() {
                var data = unescape('%cf%00%00%00%00%00%00%00%00');
                var result = [0xcf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
                var rv = msgpack.unpack(data);

                return [rv, "==", 0, hex(result)];
            },
            "[d0 00] 0 int8": function() {
                var data = unescape('%d0%00');
                var result = [0xd0, 0x00];
                var rv = msgpack.unpack(data);

                return [rv, "==", 0, hex(result)];
            },
            "[d1 00 00] 0 int16": function() {
                var data = unescape('%d1%00%00');
                var result = [0xd1, 0x00, 0x00];
                var rv = msgpack.unpack(data);

                return [rv, "==", 0, hex(result)];
            },
            "[d2 00 00 00 00] 0 int32": function() {
                var data = unescape('%d2%00%00%00%00');
                var result = [0xd2, 0x00, 0x00, 0x00, 0x00];
                var rv = msgpack.unpack(data);

                return [rv, "==", 0, hex(result)];
            },
            "[d3 00 00 00 00 00 00 00 00 ] 0 int64": function() {
                var data = unescape('%d3%00%00%00%00%00%00%00%00');
                var result = [0xd3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
                var rv = msgpack.unpack(data);

                return [rv, "==", 0, hex(result)];
            },
            "[7f] 127 Positive FixNum": function() {
                var data = unescape('%7f');
                var result = [0x7f];
                var rv = msgpack.unpack(data);

                return [rv, "==", 127, hex(result)];
            },
            "[cc 7f] 127 uint8": function() {
                var data = unescape('%cc%7f');
                var result = [0xcc, 0x7f];
                var rv = msgpack.unpack(data);

                return [rv, "==", 127, hex(result)];
            },
            "[cd 00 ff] 255 uint16": function() {
                var data = unescape('%cd%00%ff');
                var result = [0xcd, 0x00, 0xff];
                var rv = msgpack.unpack(data);

                return [rv, "==", 255, hex(result)];
            },
            "[ce 00 00 ff ff] 65535 uint32": function() {
                var data = unescape('%ce%00%00%ff%ff');
                var result = [0xce, 0x00, 0x00, 0xff, 0xff];
                var rv = msgpack.unpack(data);

                return [rv, "==", 65535, hex(result)];
            },
            "[cf 00 00 00 00 ff ff ff ff] 4294967295 uint64": function() {
                var data = unescape('%cf%00%00%00%00%ff%ff%ff%ff');
                var result = [0xcf, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff];
                var rv = msgpack.unpack(data);

                return [rv, "==", 4294967295, hex(result)];
            },
            "[e0] -32 Negative FixNum": function() {
                var data = unescape('%e0');
                var result = [0xe0];
                var rv = msgpack.unpack(data);

                return [rv, "==", -32, hex(result)];
            },
            "[d0 e0] -32 int8": function() {
                var data = unescape('%d0%e0');
                var result = [0xd0, 0xe0];
                var rv = msgpack.unpack(data);

                return [rv, "==", -32, hex(result)];
            },
            "[d1 ff 80] -128 int16": function() {
                var data = unescape('%d1%ff%80');
                var result = [0xd1, 0xff, 0x80];
                var rv = msgpack.unpack(data);

                return [rv, "==", -128, hex(result)];
            },
            "[d2 ff ff 80 00] -32768 int32": function() {
                var data = unescape('%d2%ff%ff%80%00');
                var result = [0xd2, 0xff, 0xff, 0x80, 0x00];
                var rv = msgpack.unpack(data);

                return [rv, "==", -32768, hex(result)];
            },
            "[d3 ff ff ff ff 80 00 00 00] -2147483648 int64": function() {
                var data = unescape('%d3%ff%ff%ff%ff%80%00%00%00');
                var result = [0xd3, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00];
                var rv = msgpack.unpack(data);

                return [rv, "==", -2147483648, hex(result)];
            },
            "[d3 ff ff ff ff 80 00 00 00] -2147483648 int64": function() {
                var data = unescape('%d3%ff%ff%ff%ff%80%00%00%00');
                var result = [0xd3, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00];
                var rv = msgpack.unpack(data);

                return [rv, "==", -2147483648, hex(result)];
            },
            "[ca 00 00 00 00] 0.0 float": function() {
                var data = unescape('%ca%00%00%00%00');
                var result = [0xca, 0x00, 0x00, 0x00, 0x00];
                var rv = msgpack.unpack(data);

                return [rv, "==", 0.0, hex(result)];
            },
            "[cb 00 00 00 00 00 00 00 00] 0.0 double": function() {
                var data = unescape('%cb%00%00%00%00%00%00%00%00');
                var result = [0xca, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
                var rv = msgpack.unpack(data);

                return [rv, "==", 0.0, hex(result)];
            },
            "[ca 80 00 00 00] -0.0 float": function() {
                var data = unescape('%ca%80%00%00%00');
                var result = [0xca, 0x80, 0x00, 0x00, 0x00];
                var rv = msgpack.unpack(data);

                return [rv, "==", -0.0, hex(result)];
            },
            "[cb 80 00 00 00 00 00 00 00] -0.0 double": function() {
                var data = unescape('%cb%80%00%00%00%00%00%00%00');
                var result = [0xca, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
                var rv = msgpack.unpack(data);

                return [rv, "==", -0.0, hex(result)];
            },
            "[cb 3f f0 00 00 00 00 00 00] 1.0 double": function() {
                var data = unescape('%cb%3f%f0%00%00%00%00%00%00');
                var result = [0xcb, 0x3f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
                var rv = msgpack.unpack(data);

                return [rv, "==", 1.0, hex(result)];
            },
            "[cb bf f0 00 00 00 00 00 00] -1.0 double": function() {
                var data = unescape('%cb%bf%f0%00%00%00%00%00%00');
                var result = [0xcb, 0xbf, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
                var rv = msgpack.unpack(data);

                return [rv, "==", -1.0, hex(result)];
            },

            '[a1 61] "a" FixRaw': function() {
                var data = unescape('%a1%61');
                var result = [0xa1, 0x61];
                var rv = msgpack.unpack(data);

                return [rv, "==", "a", hex(result)];
            },
            '[da 00 01 61] "a" raw 16': function() {
                var data = unescape('%da%00%01%61');
                var result = [0xda, 0x00, 0x01, 0x61];
                var rv = msgpack.unpack(data);

                return [rv, "==", "a", hex(result)];
            },
            '[db 00 00 00 01 61] "a" raw 32': function() {
                var data = unescape('%db%00%00%00%01%61');
                var result = [0xdb, 0x00, 0x00, 0x00, 0x01, 0x61];
                var rv = msgpack.unpack(data);

                return [rv, "==", "a", hex(result)];
            },

            '[a0] "" FixRaw': function() {
                var data = unescape('%a0');
                var result = [0xa0];
                var rv = msgpack.unpack(data);

                return [rv, "==", "", hex(result)];
            },
            '[da 00 00] "" raw 16': function() {
                var data = unescape('%da%00%00');
                var result = [0xda, 0x00, 0x00];
                var rv = msgpack.unpack(data);

                return [rv, "==", "", hex(result)];
            },
            '[db 00 00 00 00] "" raw 32': function() {
                var data = unescape('%db%00%00%00%00');
                var result = [0xdb, 0x00, 0x00, 0x00, 0x00];
                var rv = msgpack.unpack(data);

                return [rv, "==", "", hex(result)];
            },

            '[91 00] [0] FixArray': function() {
                var data = unescape('%91%00');
                var result = [0x91, 0x00];
                var rv = msgpack.unpack(data);

                return [rv, "==", [0], hex(result)];
            },
            '[dc 00 01 00] [0] array 16': function() {
                var data = unescape('%dc%00%01%00');
                var result = [0xdc, 0x00, 0x01, 0x00];
                var rv = msgpack.unpack(data);

                return [rv, "==", [0], hex(result)];
            },
            '[dd 00 00 00 01 00] [0] array 32': function() {
                var data = unescape('%dd%00%00%00%01%00');
                var result = [0xdd, 0x00, 0x00, 0x00, 0x01, 0x00];
                var rv = msgpack.unpack(data);

                return [rv, "==", [0], hex(result)];
            },

            '[80] {} FixMap': function() {
                var data = unescape('%80');
                var result = [0x80];
                var rv = msgpack.unpack(data);

                return [rv, "==", {}, hex(result)];
            },
            '[de 00 00] {} map 16': function() {
                var data = unescape('%de%00%00');
                var result = [0xde, 0x00, 0x00];
                var rv = msgpack.unpack(data);

                return [rv, "==", {}, hex(result)];
            },
            '[df 00 00 00 00] {} map 32': function() {
                var data = unescape('%df%00%00%00%00');
                var result = [0xdf, 0x00, 0x00, 0x00, 0x00];
                var rv = msgpack.unpack(data);

                return [rv, "==", {}, hex(result)];
            },

            '[81 a1 61 61] {"a"=>97} FixMap': function() {
                var data = unescape('%81%a1%61%61');
                var result = [0x81, 0xa1, 0x61, 0x61];
                var rv = msgpack.unpack(data);

                return [rv, "==", { a: 97 }, hex(result)];
            },
            '[de 00 01 a1 61 61] {"a"=>97} map 16': function() {
                var data = unescape('%de%00%01%a1%61%61');
                var result = [0xde, 0x00, 0x01, 0xa1, 0x61, 0x61];
                var rv = msgpack.unpack(data);

                return [rv, "==", { a: 97 }, hex(result)];
            },
            '[df 00 00 00 01 a1 61 61] {"a"=>97} map 32': function() {
                var data = unescape('%df%00%00%00%01%a1%61%61');
                var result = [0xdf, 0x00, 0x00, 0x00, 0x01, 0xa1, 0x61, 0x61];
                var rv = msgpack.unpack(data);

                return [rv, "==", { a: 97 }, hex(result)];
            },

            '[91 90] [[]]': function() {
                var data = unescape('%91%90');
                var result = [0x91, 0x90];
                var rv = msgpack.unpack(data);

                return [rv, "==", [[]], hex(result)];
            },
            '[91 91 a1 61] [["a"]]': function() {
                var data = unescape('%91%91%a1%61');
                var result = [0x91, 0x91, 0xa1, 0x61];
                var rv = msgpack.unpack(data);

                return [rv, "==", [["a"]], hex(result)];
            },
        "NaN or Infinity": "",
            '[ca 7f bf ff ff] NaN float': function() {
                var data = unescape('%ca%7F%BF%FF%FF');
                var result = [0xca, 0x7f, 0xbf, 0xff, 0xff];
                var rv = msgpack.unpack(data);

                return [rv, "is NaN", void 0, hex(result)];
            },
            '[cb ff f7 ff ff ff ff ff ff] NaN double': function() {
                var data = unescape('%cb%ff%f7%ff%ff%ff%ff%ff%ff');
                var result = [0xcb, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff];
                var rv = msgpack.unpack(data);

                return [rv, "is NaN", void 0, hex(result)];
            },
            '[ca ff 80 00 00] Infinity float': function() {
                var data = unescape('%ca%ff%80%00%00');
                var result = [0xca, 0xff, 0x80, 0x00, 0x00];
                var rv = msgpack.unpack(data);

                return [rv, "is Infinity", void 0, hex(result)];
            },
            '[cb ff f0 00 00 00 00 00 00] Infinity double': function() {
                var data = unescape('%cb%ff%f0%00%00%00%00%00%00');
                var result = [0xcb, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
                var rv = msgpack.unpack(data);

                return [rv, "is Infinity", void 0, hex(result)];
            },
            'Number(NaN) -> [0xcb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]': function() {
                var pack = msgpack.pack(NaN);
                var rv = msgpack.unpack(pack);

                return [rv, "is NaN", void 0, hex(pack)];
            },
            'Number(Infinity) -> [0xcb, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]': function() {
                var pack = msgpack.pack(Infinity);
                var rv = msgpack.unpack(pack);

                return [rv, "is Infinity", void 0, hex(pack)];
            },
        "More": "",
            'Number(0.250223099719733) -> []': function() {
                var data = 0.250223099719733;
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },

            'Number(0.3425064110197127) -> []': function() {
                var data = 0.3425064110197127;
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(-0.5991213528905064) -> []': function() {
                var data = -0.5991213528905064;
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },

            'Number(-0.008100000073710001) -> []': function() {
                var data = -0.008100000073710001;
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(0.07290000066339) -> []': function() {
                var data = 0.07290000066339;
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },

            'Number(0.06480000058968001) -> []': function() {
                var data = 0.06480000058968001;
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(0.05670000051597) -> []': function() {
                var data = 0.05670000051597;
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(0.1) -> []': function() {
                var data = 0.1;
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(0.01) -> []': function() {
                var data = 0.01;
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(0.001) -> []': function() {
                var data = 0.01;
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },

        "Random Number": "",
            'Number(Math.random(a)) ': function() {
                var data = Math.random();
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(Math.random(b))': function() {
                var data = Math.random();
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(Math.random(c))': function() {
                var data = Math.random();
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(Math.random(d))': function() {
                var data = Math.random();
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(Math.random(e))': function() {
                var data = Math.random();
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(Math.random(f))': function() {
                var data = Math.random();
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(Math.random(g))': function() {
                var data = Math.random();
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(Math.random(h))': function() {
                var data = Math.random();
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(Math.random(a) * 2) ': function() {
                var data = Math.random() * 2;
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(Math.random(b) * 2)': function() {
                var data = Math.random() * 2;
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(Math.random(c) * 2)': function() {
                var data = Math.random() * 2;
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(Math.random(d) * 2)': function() {
                var data = Math.random() * 2;
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(Math.random(e) * 2)': function() {
                var data = Math.random() * 2;
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(Math.random(f) * 2)': function() {
                var data = Math.random() * 2;
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(Math.random(g) * 2)': function() {
                var data = Math.random() * 2;
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(Math.random(h) * 2)': function() {
                var data = Math.random() * 2;
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },

            'Number(-Math.random(a)) ': function() {
                var data = -Math.random();
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(-Math.random(b))': function() {
                var data = -Math.random();
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(-Math.random(c))': function() {
                var data = -Math.random();
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(-Math.random(d))': function() {
                var data = -Math.random();
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(-Math.random(e))': function() {
                var data = -Math.random();
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(-Math.random(f))': function() {
                var data = -Math.random();
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(-Math.random(g))': function() {
                var data = -Math.random();
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(-Math.random(h))': function() {
                var data = -Math.random();
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(-Math.random(a) * 2) ': function() {
                var data = -Math.random() * 2;
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(-Math.random(b) * 2)': function() {
                var data = -Math.random() * 2;
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(-Math.random(c) * 2)': function() {
                var data = -Math.random() * 2;
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(-Math.random(d) * 2)': function() {
                var data = -Math.random() * 2;
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(-Math.random(e) * 2)': function() {
                var data = -Math.random() * 2;
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(-Math.random(f) * 2)': function() {
                var data = -Math.random() * 2;
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(-Math.random(g) * 2)': function() {
                var data = -Math.random() * 2;
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
            'Number(-Math.random(h) * 2)': function() {
                var data = -Math.random() * 2;
                var pack = msgpack.pack(data);
                var rv = msgpack.unpack(pack);

                return [rv, "is", data, hex(pack)];
            },
        "CYCLIC REFERENCE ERROR": "",
            "msgpack.pack": function() {
                var ary = [];
                var hash = {
                    ary: ary
                };
                ary[0] = hash;

                var pack = msgpack.pack(hash);

                return [msgpack.isError(), "is true"]
            },
        "UNKNOWN TYPE ERROR": "",
            "msgpack.unpack": function() {
                var ary = [0xff, 0x01, 0xf2];

                rv = msgpack.unpack(ary);
                return [msgpack.isError(), "is true"]
            }
    });
});
</script>
</head><body></body></html>
